<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAuthorizerInfosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('authorizer_infos', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('enterprise_id')         ->default(0)->comment('授权方企业id');
            $table->bigInteger('user_id')               ->default(0)->comment('授权方用户id');
            $table->string('auth_code')                 ->default('')->comment('授权方授权码');
            $table->string('authorizer_appid')          ->default('')->comment('授权方appid');
            $table->string('authorizer_access_token')   ->default('')->comment('接口调用令牌');
            $table->integer('expires_in')               ->default(0) ->comment('authorizer_access_token 的有效期');
            $table->string('authorizer_refresh_token')  ->default('')->comment('刷新令牌');
            $table->text('func_info')                   ->nullable()       ->comment('授权给开发者的权限集列表');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('authorizer_infos');
    }
}
